package shun.demo.remote.touch.client;

import android.graphics.Point;

import java.io.*;
import java.net.Socket;

/**
 * Created by chen on 14-4-25.
 */
public class InputClient {

    public ObjectOutputStream connect(String address) {
        try {
            Socket socket = new Socket(address, 5678);

            // first receive the resolution of the remote display
//            InputStream is = socket.getInputStream();
//            ObjectInputStream ois = new ObjectInputStream(is);
//            try {
//                Object o = ois.readObject();
//                Point p = (Point) o;
//            } catch (ClassNotFoundException e) {
//                e.printStackTrace();
//            }

            // second send the InputEvent
            OutputStream os = socket.getOutputStream();
            ObjectOutputStream oos = new ObjectOutputStream(os);
            return oos;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
